<?php $form = $this->beginWidget('CActiveForm', array(
	'id' => 'site_config-form',
	'enableClientValidation' => true,
	'clientOptions' => array(
		'validateOnSubmit' => true,
	),
)); ?>
	<?php echo $form->hiddenField($siteConfigForm, 'id_config'); ?>

	<h5><?php echo t('page', 'General Setting'); ?></h5>
	<?php echo CHtml::tag('label', array(), $siteConfigForm->getFieldLabel('general_ssl')); ?>
	<?php echo $form->dropDownList($siteConfigForm, 'general_ssl', $siteConfigForm->listSsl()); ?>
	<span class="help-inline"><?php echo t('info', 'Given the nature of the data used by __Whatever__, it is recommended to use HTTPS.'); ?></span>
	
	<?php echo CHtml::tag('label', array(), $siteConfigForm->getFieldLabel('general_language')); ?>
	<?php echo $form->dropDownList($siteConfigForm, 'general_language', $siteConfigForm->listLanguage()); ?>
	<span class="help-inline"><?php echo t('info', 'Additional translations will be available in future versions.'); ?></span>
	
	<?php echo CHtml::tag('label', array(), $siteConfigForm->getFieldLabel('general_autorefreshcpdata')); ?>
	<?php echo $form->dropDownList($siteConfigForm, 'general_autorefreshcpdata', $siteConfigForm->listAutoPullCpData()); ?>
	<span class="help-inline"><?php echo t('info', 'Poll WHM servers for changes to cPanel accounts to update __Whatever__ records.'); ?></span>
	
	<h5><?php echo t('page', 'System Logging'); ?></h5>
	<?php echo CHtml::tag('label', array(), $siteConfigForm->getFieldLabel('log_login')); ?>
	<?php echo $form->dropDownList($siteConfigForm, 'log_login', $siteConfigForm->listEnDis()); ?>
	<span class="help-inline"><?php echo t('info', 'Log user login activity.'); ?></span>
	
	<?php echo CHtml::tag('label', array(), $siteConfigForm->getFieldLabel('log_action')); ?>
	<?php echo $form->dropDownList($siteConfigForm, 'log_action', $siteConfigForm->listEnDis()); ?>
	<span class="help-inline"><?php echo t('info', 'Log user actions in system.'); ?></span>
	
	<?php echo CHtml::tag('label', array(), $siteConfigForm->getFieldLabel('log_purgetime')); ?>
	<?php echo $form->dropDownList($siteConfigForm, 'log_purgetime', $siteConfigForm->listPurgeTime()); ?>
	<span class="help-inline"><button class="btn btn-small btn-danger" type="button" data-loading-text="Purge..." id="purgelogs_but"><?php echo t('buttons', 'Purge Logs'); ?></button></span>
	<div class="row-fluid">
		<div class="span12 hide" id="purge_success">
			<div class="alert alter-block alert-error">
				<button type="button" class="close" data-dismiss="alert">&times;</button>
				<h4>Success</h4>
				<div class="content"></div>
			</div>
		</div>
	</div>
	<script>
		$('#purgelogs_but').click(function(){
			var obj = $(this);
			obj.button('loading');
			$.ajax({
				url: '<?php echo url('configure/purgelogs'); ?>',
				type: 'post',
				data: {purgetime: $('#SiteConfigForm_log_purgetime').val()},
				success: function(ret){
					obj.button('reset');
					
					$("#purge_success").blink({
						"beforeCall": function(){
							$("#purge_success .content").html('<p>'+ret.loginLogsDeleted+' login logs have been purged!</p><p>'+ret.actionLogsDeleted+' action logs have been purged!');
						}
					});
				},
				dataType: 'json'
			});
		});
	</script>
	
	<h5><?php echo t('page', 'System Security'); ?></h5>
	<?php echo CHtml::tag('label', array(), $siteConfigForm->getFieldLabel('security_max_failed_login')); ?>
	<?php echo $form->textField($siteConfigForm, 'security_max_failed_login'); ?>
	<span class="help-inline"><?php echo t('info', 'Maximum failed login attempts prior to account suspension. Set 0 to disable.'); ?></span>
	
	<?php echo CHtml::tag('label', array(), $siteConfigForm->getFieldLabel('security_captcha')); ?>
	<?php echo $form->dropDownList($siteConfigForm, 'security_captcha', $siteConfigForm->listEnDis()); ?>
	<span class="help-inline"><?php echo t('info', 'Help prevent brute force login attacks.'); ?></span>
	
	<?php echo CHtml::tag('label', array(), $siteConfigForm->getFieldLabel('security_pwd_rotation')); ?>
	<?php echo $form->dropDownList($siteConfigForm, 'security_pwd_rotation', $siteConfigForm->listEnDis()); ?>
	<span class="help-inline"><?php echo t('info', 'Automated weekly WHM Account password changes.'); ?></span>
	
	<h5><?php echo t('page', 'System Emails'); ?> (<a href="#"><?php echo t('page', 'Edit System Emails'); ?></a>)</h5>
	<?php echo CHtml::tag('label', array(), $siteConfigForm->getFieldLabel('email_type')); ?>
	<?php echo $form->dropDownList($siteConfigForm, 'email_type', $siteConfigForm->listMailType()); ?>
	<span class="help-inline"><?php echo t('info', 'Select your desired mail type.'); ?></span>
	<div class="hide" id="smpt_details">
		<?php echo CHtml::tag('label', array(), $siteConfigForm->getFieldLabel('smtp_host')); ?>
		<?php echo $form->textField($siteConfigForm, 'smtp_host', array('class' => 'field')); ?>
		
		<?php echo CHtml::tag('label', array(), $siteConfigForm->getFieldLabel('smtp_port')); ?>
		<?php echo $form->textField($siteConfigForm, 'smtp_port', array('class' => 'field')); ?>
		
		<?php echo CHtml::tag('label', array(), $siteConfigForm->getFieldLabel('smtp_username')); ?>
		<?php echo $form->textField($siteConfigForm, 'smtp_username', array('class' => 'field')); ?>
		
		<?php echo CHtml::tag('label', array(), $siteConfigForm->getFieldLabel('smtp_password')); ?>
		<?php echo $form->textField($siteConfigForm, 'smtp_password', array('class' => 'field')); ?>
	</div>
	<script>
		$('#SiteConfigForm_email_type').change(function(){
//			$('#smpt_details .field').val('');
			if($(this).val() == '<?php echo SiteConfig::MAIL_ORI; ?>'){
				$('#smpt_details').hide();
			}else{
				$('#smpt_details').show();
			}
		}).change();
	</script>
			
	<?php echo CHtml::tag('label', array(), $siteConfigForm->getFieldLabel('email_from_name')); ?>
	<?php echo $form->textField($siteConfigForm, 'email_from_name'); ?>
	<span class="help-inline"><?php echo t('info', 'The name emails from the system show.'); ?></span>
	
	<?php echo CHtml::tag('label', array(), $siteConfigForm->getFieldLabel('email_from_address')); ?>
	<?php echo $form->textField($siteConfigForm, 'email_from_address'); ?>
	<span class="help-inline"><?php echo t('info', 'The email address emails from the system show.'); ?></span>
			
	<br />
	<?php echo CHtml::tag('button', array('type' => 'submit', 'class' => 'btn btn-primary'), t('buttons', 'Save Config')); ?>
<?php $this->endWidget(); ?>